#include"../thread_pool.h"
#include "../user.h"

//用于添加表项时的结构体
typedef struct {
    int id;
    int parent_id;
    char filename[50];
    int owner_id;
    char md5[128];
    int filesize;
    char type[10];
    char pwd[100];
}VF_entry;
//general
void connect_mysql(user_info* user);
//用户注册
int Add_user(user_info* user);
void select_user(user_info* user ,char* str[3]);
void select_user_changeid(user_info* user);
//虚拟文件表的操作
void select_file_ls(user_info * user);
void select_file_md5from(user_info* user, const char* filename, char* md5);
int select_file_cd(user_info * user,char *dirname);
/* void select_parent_id(user_info* user, int* parent_id); */  
int select_parent_id(user_info* user);
int select_file_id(user_info* user,char* parent_wd);

void add_file(VF_entry *entry,user_info * user);
void add_virtual_table(user_info* user, int parent_id, const char* filename, const char* md5, int filelen, const char* type);
void select_issame_from_vartual_table(user_info* user,int* id, int parent_id, const char* filename);
//删除目录项和删除文件项
void delete_file_rmdir(user_info * user,char *pwd,char *filename);
void delete_file(user_info * user,char *pwd,char *filename);//递归删除中，要删除的文件可能是userpwd目录下更深层目录

//对md5表的操作
int select_md5_table(const char* buff, int* length);
int add_md5_table(user_info * user, const char* buff, int filelength);

